/*
 * template Page.h
 *
 *  Created on: 29/09/2010
 *      Author: paulo
 */

#ifndef PAGE_H_
#define PAGE_H_

#include "Cache.hpp"
#include "WeakPointer.hpp"
#include "SmartPointer.hpp"

template<class Key, class DataRef, class Compare>

class Page
{
public:
	typedef Key 							key_type;
	typedef Compare 						compare_type;
	typedef Page<Key, DataRef, Compare> 	leafPage;
	typedef Page<Key, DataRef, Compare> 	page;
	typedef Page<Key, DataRef, Compare> 	indexPage;

	typedef SmartPointer<indexPage,CacheType>	PagePtr_t;
	typedef SmartPointer<indexPage,CacheType>	iPagePtr_t;//index page referencia
	typedef SmartPointer<indexPage,CacheType>	lPagePtr_t;//leaf page referencia

public:
	virtual ~Page() {
	}
	;
	virtual bool isLeaf()=0;
	virtual iPagePtr_t getIndexPage()
	{
		return 0;
	}
	virtual lPagePtr_t getLeafPage()
	{
		return 0;
	}
	virtual bool isFull()=0;
	virtual bool isSparse()=0;
	virtual key_type getPageKey()=0;
	virtual iPagePtr_t getParent()=0;
	virtual void setParent(iPagePtr_t p) =0;

};//fin clase Page

};

#endif /* PAGE_H_ */
